﻿using System;
using System.Collections.Generic;
using System.Text;

namespace skydream
{
    public class ComHelp
    {
        //
        // 摘要:
        //     得到本机的所有com口
        //
        // 返回结果:
        //     返回ip地址
        public static string[] com() //取得本电脑串口
        {
           
                Microsoft.Win32.RegistryKey softKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software", true);
                softKey = Microsoft.Win32.Registry.LocalMachine.CreateSubKey("HARDWARE\\DEVICEMAP\\SERIALCOMM");

                string[] s = softKey.GetValueNames();
                string[] Coms = new string[s.Length];
                for (int i = 0; i < s.Length; i++)
                {
                    Coms[i]=softKey.GetValue(s[i], " ").ToString();
                }
                return Coms;
        }
    }
}
